const VOLUME_MAX = 65536.0; /* PA_VOLUME_NORM */
const VOLUME_ADJUSTMENT_STEP = 0.05; /* Volume adjustment step in % */
+const VOLUME_NOTIFY_ID = 1;
+
function Indicator() {
this._init.apply(this, arguments);
}
this._output.change_is_muted(false);
this._output.push_volume();
}
+
+ this._notifyVolumeChange();
},
_onControlReady: function() {
},
_notifyVolumeChange: function() {
- global.play_theme_sound('audio-volume-change');
+ global.cancel_theme_sound(VOLUME_NOTIFY_ID);
+ global.play_theme_sound(VOLUME_NOTIFY_ID, 'audio-volume-change');
},
_mutedChanged: function(object, param_spec, property) {
/**
* shell_global_play_theme_sound:
* @global: the #ShellGlobal
+ * @id: an id, used to cancel later (0 if not needed)
* @name: the sound name
*
* Plays a simple sound picked according to Freedesktop sound theme.
*/
void
shell_global_play_theme_sound (ShellGlobal *global,
+ guint id,
const char *name)
{
- ca_context_play (global->sound_context, 0, CA_PROP_EVENT_ID, name, NULL);
+ ca_context_play (global->sound_context, id, CA_PROP_EVENT_ID, name, NULL);
+}
+
+/**
+ * shell_global_cancel_theme_sound:
+ * @global: the #ShellGlobal
+ * @id: the id previously passed to shell_global_play_theme_sound()
+ *
+ * Cancels a sound notification.
+ */
+void
+shell_global_cancel_theme_sound (ShellGlobal *global,
+ guint id)
+{
+ ca_context_cancel (global->sound_context, id);
}
/*
GDestroyNotify notify);
void shell_global_play_theme_sound (ShellGlobal *global,
+ guint id,
const char *name);
+void shell_global_cancel_theme_sound (ShellGlobal *global,
+ guint id);
void shell_global_init_xdnd (ShellGlobal *global);